const mysql = require("mysql");

let createPool = mysql.createPool({
  post:"loaclhost",
  port:3306,
  user:"root",
  password:"a62800492",
  database:"test"
})
//新增
/*createPool.query(`INSERT INTO user VALUES(0,"bule",21,?),(0,"myth",22,?)`,["99","98"],(err,data)=>{
  if(err){
    console.log(err)
    return false;
  }
  console.log(data.insertId);
});*/
/*createPool.query(`INSERT INTO user SET ?`,{id:0,name:"哈哈",img:"哟西"},(err,data)=>{
  if(err){
    console.log(err)
    return false;
  }
  console.log(data.insertId);
});*/
//删除
/*createPool.query(`DELETE FROM user  WHERE id=?`,["4"],(err,data)=>{
  if(err){
    console.log(err)
    return false;
  }
  console.log(data);
});*/
//查询
/*createPool.query("select * from user",(err,data)=>{
  if(err){
    console.log(err)
    return false;
  }
  console.log(data);
});*/
//修改
/*createPool.query(`UPDATE user SET ? where id=9`,{name:"嘿嘿",ctime:"2018-09-28"},(err, results, fields)=>{
  if(err){
    console.log(err)
    return false;
  }
  console.log(results);
  console.log(fields);
});*/